#include<iostream>
using namespace std;
int main(){
    int n,cur=0,to_where,time=0;
    cin>>n;
    for (int i = 0; i < n; i++)
    {
        cin>>to_where;
        if(to_where>cur){
            time=6*(to_where-cur)+5+time;
            cur=to_where;
        }
        else if(to_where<cur){
            time=4*(cur-to_where)+5+time;
            cur=to_where;
        }
        else if(to_where==cur)time+=5;
    }
    cout<<time;
}